package com.demo.blog;

import com.demo.common.model.Person;
import com.jfinal.aop.Before;
import com.jfinal.core.Controller;

/**
 * @author liliang
 * @description:
 * @date 2018/6/1.
 */
@Before(BlogInterceptor.class)
public class PersonController extends Controller {

    PersonService service = PersonService.personService;

    public void page() {
        renderJson(service.findById(getParaToInt()));
    }

    @Before(PersonValidator.class)
    public void save() {
        renderJson(service.save(getBean(Person.class)));
    }

    public void paginate() {
        renderJson(service.paginate(getParaToInt("pageNumber"),getParaToInt("pageSize")));
    }

}
